import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router';
import Login from '../views/login.vue';
import Users from '../views/users.vue';
import Register from '../views/register.vue';

//子路由
import Info from '../views/UserChildren/Info/info.vue';
import ClassCenter from '../views/UserChildren/ClassCenter/classcenter.vue';
import ClassView from '../views/UserChildren/ClassManage/classview.vue';
import ClassMessage from '../views/UserChildren/ClassManage/classmessage.vue'
import ClassSet from '../views/UserChildren/ClassManage/classset.vue'
import SystemSet from '../views/UserChildren/SystemSet/systemset.vue'
import Vacation from '../views/UserChildren/VacationManage/vacation.vue'
import Biodata from '../views/UserChildren/Biodata/biodata.vue'
import Account from '../views/UserChildren/AccountManage/account.vue'
//图标
import info from '../assets/list/info.svg'
import classcenter from '../assets/list/classcenter.svg'
import classmanage from '../assets/list/classmanage.svg'
import vacationmanage from '../assets/list/vacationmanage.svg'
import accountmanage from '../assets/list/accountmanage.svg'
import systemset from '../assets/list/systemset.svg'
import biodata from '../assets/list/biodata.svg'
const routes: RouteRecordRaw[] = [
  {
    path: '/login',
    name: 'login',
    component: Login,
  },
  {
    path: '/register',
    name: 'register',
    component: Register,
  },
  {
    path: '/user',
    name: 'user',
    component: Users,
    children:[
      {
        path:'/info',
        name:'info',
        component:Info,
        meta:{
          title:'首页',
          icon:info
        },
        children:[
          {
            path:'/test',
            name:'test',
            component:()=>('../views/UserChildren/Info/Test.vue'),
            meta:{
              title:'Test'
            }
          },
        ]
      },
      {
        path:'/classcenter',
        name:'classcenter',
        component:ClassCenter,
        meta:{
          title:'课程中心',
          icon:classcenter
        },
        children:[
          {
            path:'/test',
            name:'test',
            component:()=>('../views/UserChildren/ClassCenter/Test.vue'),
            meta:{
              title:'Test'
            }
          },
        ]
      },      
      {
        path:'/classmanage',
        name:'classmanage',
        component:ClassView,
        meta:{
          title:'课程管理',
          icon:classmanage
        },
        children:[
          {
            path:'/classmessage',
            name:'classmessage',
            component:ClassMessage,
            meta:{
              title:'课程信息'
            }
          },
          {
            path:'classset',
            name:'classset',
            component:ClassSet,
            meta:{
              title:'课程设置'
            }
          }
        ]
      },
      {
        path:'/vacationmanage',
        name:'vacationmanage',
        component:Vacation,
        meta:{
          title:'请假管理',
          icon:vacationmanage
        },
        children:[
          {
            path:'/test',
            name:'test',
            component:()=>('../views/UserChildren/VacationManage/Test.vue'),
            meta:{
              title:'Test'
            }
          },
        ]
      }, 
      {
        path:'/accountmanage',
        name:'accountmanage',
        component:Account,
        meta:{
          title:'账号管理',
          icon:accountmanage
        },
        children:[
          {
            path:'/test',
            name:'test',
            component:()=>('../views/UserChildren/AccountManage/Test.vue'),
            meta:{
              title:'Test'
            }
          },
        ]
      },
      {
        path:'/systemset',
        name:'systemset',
        component:SystemSet,
        meta:{
          title:'系统设置',
          icon:systemset
        },
        children:[
          {
            path:'/test',
            name:'test',
            component:()=>('../views/UserChildren/SystemSet/Test.vue'),
            meta:{
              title:'Test'
            }
          },
        ]
      },
      {
        path:'/biodata',
        name:'biodata',
        component:Biodata,
        meta:{
          title:'个人中心',
          icon:biodata
        },
        children:[
          {
            path:'/test',
            name:'test',
            component:()=>('../views/UserChildren/Biodata/Test.vue'),
            meta:{
              title:'Test'
            }
          },
        ]
      },   
    ]
  },
  {
    path: '/',
    redirect: { name: 'login' },
  }
];

const router = createRouter({
  history: createWebHashHistory(process.env.BASE_URL),
  routes,
});

export default router;
